package com.video_study.controller;

import com.video_study.pojo.Course;
import com.video_study.result.ResponseData;
import com.video_study.service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/course")
public class CourseController {
    @Autowired
    CourseService courseService;
    @RequestMapping(value = "/",method = RequestMethod.GET)
    public ResponseData getCourseById(String id){
        return courseService.getCourseById(id);
    }
    @RequestMapping(value = "/types/",method = RequestMethod.GET)
    public ResponseData getTypes(){
        return courseService.getTypes();
    }

    @RequestMapping(value = "/courses/",method = RequestMethod.GET)
    public ResponseData getCoursesByType(String type){
        return courseService.getCourses(type);
    }

    @RequestMapping(value = "/updatelikes",method = RequestMethod.GET)
    public ResponseData updateLikes(Course course){
        return courseService.updateLikes(course);
    }
}
